package com.dst.controller;

import com.dst.entity.User;
import com.dst.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpSession;

@Controller
public class USerController {
    @Autowired
    private UserService userService;
    @RequestMapping("/longinController")
    public String selectUserByUsernameandPassword(String username, String password, HttpSession session){
        User login = userService.login(username, password);
        System.out.println("login = " + login);
        if(login!=null){
            session.setAttribute("login",login);
            return "/phone/selectAllController.do";
        }else {
            return "/index.jsp";
        }
    }
}
